Skip to content

Arm backend: Use bucket approach in fuse_equal_placeholder_pass #13271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2025

Conversation

Erik-Lundell
Copy link
Collaborator

@Erik-Lundell Erik-Lundell commented Aug 11, 2025

Verified to catch same dupes as before in lstm and mv2.

Instead of comparing all placeholders to each other, compute a hash use as key in dictionary. Equal placeholder -> equal key. If an entry in the dictionary has multiple values, we have duplicates.

This is a ~O(N) algorithm compared to earlier O(N^2). This can be seen by measuring the speedup for lstm vs. mv2

lstm: 120 placeholders (116 dupes) 0.4s -> 0.3s

mv2: 318 placeholders (98 dupes) ~15s -> 0.5s

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218

Verified to catch same dupes as before in lstm and mv2.

Instead of comparing all placeholders to each other, compute
a hash use as key in dictionary. Equal placeholder -> equal key.
If an entry in the dictionary has multiple values, we have duplicates.

This is a ~O(N) algorithm compared to earlier  O(N^2).
This can be seen by measuring the speedup for lstm vs. mv2

lstm: 120 placeholders (116 dupes) 0.4s -> 0.3s

mv2: 318 placeholders (98 dupes) ~15s -> 0.5s

Signed-off-by: Erik Lundell <[email protected]>
Change-Id: I7e2e614402488e7f9437cd7db5212c928176ba32
Copy link

pytorch-bot bot commented Aug 11, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13271

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 2 Cancelled Jobs, 1 Unrelated Failure

As of commit cdadc5e with merge base 72580d2 (image):

NEW FAILURE - The following job has failed:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 11, 2025
@Erik-Lundell Erik-Lundell added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk release notes: none Do not include this in the release notes and removed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Aug 11, 2025
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 11, 2025
@Erik-Lundell
Copy link
Collaborator Author

Test failures unrelated.

@Sebastian-Larsson Sebastian-Larsson merged commit 3067e98 into pytorch:main Aug 11, 2025
232 of 240 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: none Do not include this in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants